package com.ym.jiujiangeyou.database;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * @author 叶铭
 * @email yeming_1001@163.com
 * @version V1.0
 */
@SuppressLint("NewApi")
public class DataBaseHelper extends SQLiteOpenHelper {

	private final static String DBNAME = "collect.db";
	private final static int VERSION = 1;
	private final static String CREATE_SCENERY_TABLE = "create table if not exists scenery(id Integer primary key autoincrement,sname varchar(20),"
			+ "sid int,address varchar(30),introduction varchar(1000),ticket varchar(10),type varchar(20),imageurl varchar(100),longitude double,"
			+ "latitude double,openTime varchar(20),phoneNumber varchar(10),traffic varchar(1000),prompt varchar(500),gticket varchar(100))";
	
	private final static String CREATE_HOTEL_TABLE = "create table if not exists hotel(id Integer primary key autoincrement,hname varchar(20),"
			+ "hid int,address varchar(30),introduction varchar(1000),imageurl varchar(100),longitude double,"
			+ "latitude double,priceinfo varchar(200),phone varchar(10),traffic varchar(1000),facility varchar(1000),price varchar(10))";

	public DataBaseHelper(Context context) {
		super(context, DBNAME, null, VERSION);
	}

	public DataBaseHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	public DataBaseHelper(Context context, String name, CursorFactory factory,
			int version, DatabaseErrorHandler errorHandler) {
		super(context, name, factory, version, errorHandler);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(CREATE_SCENERY_TABLE);
		db.execSQL(CREATE_HOTEL_TABLE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub

	}

}
